package com.cskaoyan.service.stat;

import com.cskaoyan.mapper.OrderMapper;
import com.cskaoyan.mapper.Order_goodsMapper;
import com.cskaoyan.mapper.UserMapper;
import com.cskaoyan.vo.stat.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * description:
 * author:houzhitao@139.com
 */
@Service
public class StatServiceImpl implements StatService {

    @Autowired
    UserMapper userMapper;
    @Autowired
    OrderMapper orderMapper;
    @Autowired
    Order_goodsMapper orderGoodsMapper;

    @Override
    public StatUserVo statUser() {
        //统计用户相关的指标的查询
        List<StatUserSonRowsVo> userSonRows = userMapper.selectUserCountByAddTime();
        StatUserVo statUserVo = new StatUserVo();
        statUserVo.setRows(userSonRows);
        return statUserVo;
    }

    @Override
    public StatOrderVo statOrder() {
        //统计order相关的指标的查询
        List<StatOrderSonRowsVo> orderSonRows = orderMapper.selectStatByAddTime();
        StatOrderVo statOrderVo = new StatOrderVo();
        statOrderVo.setRows(orderSonRows);
        return statOrderVo;
    }

    @Override
    public StatGoodsVo statGoods() {
        //统计order_goods相关指标的查询
        List<StatGoodsSonRowsVo> rowsBeans = orderGoodsMapper.selectStatByAddTime();
        StatGoodsVo statGoodsVo = new StatGoodsVo();
        statGoodsVo.setRows(rowsBeans);
        return statGoodsVo;
    }
}
